module.exports = class extends think.Logic {
  addAction() {
    this.allowMethods = 'post';
    this.rules = {
      pid: {
        int: true,
        required: true,
        method: 'POST'
      },
      title: {
        string: true,
        required: true,
        method: 'POST'
      },
      type: {
        int: {min: 0, max: 1},
        required: true,
        method: 'POST'
      },
      proposer: {
        string: true,
        required: true,
        method: 'POST'
      },
      number: {
        int: true,
        required: true,
        method: 'POST'
      },
      startDate: {
        int: true,
        required: true,
        method: 'POST'
      },
      endDate: {
        int: true,
        required: true,
        method: 'POST'
      },
      content: {
        string: true,
        required: true,
        method: 'POST'
      }
    };
  }
  editAction() {
    this.allowMethods = 'put';
    this.rules = {
      pid: {
        int: true,
        required: true,
        method: 'PUT'
      },
      title: {
        string: true,
        required: true,
        method: 'PUT'
      },
      type: {
        int: {min: 0, max: 1},
        required: true,
        method: 'PUT'
      },
      proposer: {
        string: true,
        required: true,
        method: 'PUT'
      },
      number: {
        int: true,
        required: true,
        method: 'PUT'
      },
      startDate: {
        int: true,
        required: true,
        method: 'PUT'
      },
      endDate: {
        int: true,
        required: true,
        method: 'PUT'
      },
      content: {
        string: true,
        required: true,
        method: 'PUT'
      },
      id: {
        int: true,
        required: true,
        method: 'GET'
      }
    };
  }
  delAction() {
    this.allowMethods = 'delete';
    this.rules = {
      id: {
        int: true,
        required: true,
        method: 'GET'
      }
    };
  }
  listAction() {
    this.allowMethods = 'get';
  }
};
